package com.example.chat.controller;

import com.dragonsoftbravo.libs.Opr;
import com.example.chat.model.ro.AssetsRequestRecordRO;
import com.example.chat.service.AssetsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Description
 * @Date 2022/11/16 11:52
 * @Author pq
 */
@Api(value = "固定资产", tags = {"固定资产"})
@RestController
@RequestMapping("/assets")
public class AssetsManagerController extends BaseController{
    @Resource
    private AssetsService assetsService;

    @ApiOperation(value = "新增固资申请")
    @PostMapping(value = "/saveRequestRecord")
    public ResponseEntity<Opr<Void>> saveRecord(@Validated @RequestBody AssetsRequestRecordRO assetsRequestRecordRo, BindingResult bindingResult){
        validateFiled(bindingResult);
        String empId = currentUser();
        assetsService.submitAssetsRequest(assetsRequestRecordRo , empId);
        return processOpr(this::successResult);
    }


}
